package com.owc.controller.admin;

import com.owc.domain.BaseResult;
import com.owc.domain.dto.admin.DrawDTO;
import com.owc.domain.dto.admin.DrawDetailDTO;
import com.owc.domain.vo.admin.DrawQueryVo;
import com.owc.service.admin.DrawService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * @Author xiaom
 * @Date 2019/12/24 15:02
 * @Version 1.0.0
 * @Description <>
 **/
@RestController
@RequestMapping(value = "/admin/drawout")
public class DrawController {

    @Autowired
    private DrawService drawService;

    @PostMapping(value = "list")
    public BaseResult<List<DrawDTO>> list(@RequestBody @Valid DrawQueryVo drawQueryVo){
        return drawService.list(drawQueryVo);
    }

    @PostMapping(value = "/detail")
    public BaseResult<DrawDetailDTO> detail(@RequestBody @Valid DrawQueryVo drawQueryVo){
        Assert.notNull(drawQueryVo.getId(),"划转id不能为空");
        return BaseResult.success(drawService.detail(drawQueryVo.getId()));
    }

}
